home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: June 16, 1997
- // Author: sw
- //
- // Procedure Name:
- // AEleastSquaresModifierTemplate
- //
- // Description Name;
- // Creates the attribute editor controls for the leastSquaresModifier node
- //
- // Input Value:
- // nodeName
- //
- // Output Value:
- // None
- //
-
- global proc AEleastSquaresModifierTemplate ( string $nodeName )
- {
- editorTemplate -beginScrollLayout;
- editorTemplate -beginLayout "Least Squares Modifier Attributes" -collapse 0;
-
- editorTemplate -callCustom
- "AELSMInputNurbsObjectNew"
- "AELSMInputNurbsObjectReplace"
- "attributeCollection";
- editorTemplate -callCustom
- "AELSMPointConstraintNew"
- "AELSMPointConstraintReplace"
- "attributeCollection.pointConstraint";
- editorTemplate -endLayout;
-
- // suppressed attributes
- editorTemplate -suppress "updatePointModifier";
- editorTemplate -suppress "resetModifier";
- editorTemplate -suppress "objectModifier";
- editorTemplate -suppress "inputCache";
- editorTemplate -suppress "pointSymbolicIndex";
- editorTemplate -suppress "attributeCollection";
-
- // include/call base class/node attributes
- AEabstractBaseCreateTemplate $nodeName;
-
- editorTemplate -addExtraControls;
- editorTemplate -endScrollLayout;
- }
-
-
- proc AEconnectLSMPointConstraintControls( string $nodeName,
- string $pointConstraint )
- {
- // get the index
- //
- string $number[];
- tokenize($pointConstraint,"[]",$number);
- string $index = $number[1];
- if ( $index == "" ) return;
-
- // build the plugName
- //
- string $plugName = $nodeName+".attributeCollection."+$pointConstraint;
-
- // connect the controls
- //
- setParent AELSMPointConstraintLayout;
- frameLayout -e -l $pointConstraint ("AELSMPointConstraintFrame"+$index);
- connectControl ("AELSMPointConstraintU"+$index) -index 2 ($plugName+".pointConstraintUVW.pointConstraintU");
- connectControl ("AELSMPointConstraintWeight"+$index) ($plugName+".pointWeight");
-
- }
-
-
- proc AEcreateNewLSMPointConstraintControls( string $nodeName,
- string $pointConstraint )
- {
- // get the index
- //
- string $number[];
- tokenize($pointConstraint,"[]",$number);
- string $index = $number[1];
- if ( $index == "" ) return;
-
- setUITemplate -pst attributeEditorTemplate;
- frameLayout -cl false -cll false ("AELSMPointConstraintFrame"+$index);
- columnLayout -adj true;
- floatFieldGrp -nf 1 -l "U" ("AELSMPointConstraintU"+$index);
- floatSliderGrp -f true -l "Weight" -min 0.1 -max 1.0 ("AELSMPointConstraintWeight"+$index);
- setParent ..;
- setParent ..;
- AEconnectLSMPointConstraintControls( $nodeName, $pointConstraint );
- setUITemplate -ppt;
- }
-
-
- global proc AELSMPointConstraintNew ( string $plug )
- {
- // get the nodeName
- //
- string $buffer[];
- tokenize($plug,".",$buffer);
- string $nodeName = $buffer[0];
-
- // get all of the elements of the array
- //
- string $tmpPoints[] = `listAttr -m $plug`;
- string $pointConstraints[];
- for ($tmp in $tmpPoints) {
- string $tmpBuffer[];
- tokenize($tmp,".",$tmpBuffer);
- if (size($tmpBuffer) == 1) {
- $pointConstraints[size($pointConstraints)] = $tmp;
- }
- }
- int $numPointConstraints = size($pointConstraints);
-
- setUITemplate -pst attributeEditorTemplate;
- frameLayout -l "Point Constraints" -cl false -cll true;
- columnLayout -adj true AELSMPointConstraintLayout;
- for ( $pointConstraint in $pointConstraints ) {
- AEcreateNewLSMPointConstraintControls($nodeName, $pointConstraint);
- }
- setParent ..;
- setParent ..;
- setUITemplate -ppt;
- }
-
-
- global proc AELSMPointConstraintReplace ( string $plug )
- {
- // get the nodeName
- //
- string $buffer[];
- tokenize($plug,".",$buffer);
- string $nodeName = $buffer[0];
-
- string $tmpPoints[] = `listAttr -m $plug`;
- string $newPointConstraints[];
- for ($tmp in $tmpPoints) {
- string $tmpBuffer[];
- tokenize($tmp,".",$tmpBuffer);
- if (size($tmpBuffer) == 1) {
- clear $tmpBuffer;
- tokenize($tmp,"[]",$tmpBuffer);
- if ( size($tmpBuffer) > 1 ) {
- $newPointConstraints[size($newPointConstraints)] = $tmp;
- }
- }
- }
- int $newNumPointConstraints = size($newPointConstraints);
- string $oldPointConstraintLayouts[] = `columnLayout -q -ca AELSMPointConstraintLayout`;
- int $oldNumPointConstraints = size ($oldPointConstraintLayouts);
-
- setParent AELSMPointConstraintLayout;
- columnLayout -e -vis false AELSMPointConstraintLayout;
-
- if ( $newNumPointConstraints >= $oldNumPointConstraints ) {
-
- // replace what we can
- //
- for ( $i = 0; $i < $oldNumPointConstraints; $i++ ) {
- setParent $oldPointConstraintLayouts[$i];
- AEconnectLSMPointConstraintControls($nodeName, $newPointConstraints[$i]);
- }
-
- // and build what we need
- //
- setParent AELSMPointConstraintLayout;
- for ($i = $oldNumPointConstraints; $i < $newNumPointConstraints; $i++) {
- AEcreateNewLSMPointConstraintControls($nodeName, $newPointConstraints[$i]);
- }
-
- } else {
-
- // replace what we need
- //
- for ( $i = 0; $i < $newNumPointConstraints; $i++ ) {
- setParent $oldPointConstraintLayouts[$i];
- AEconnectLSMPointConstraintControls($nodeName, $newPointConstraints[$i]);
- }
-
- // delete old rowLayouts
- //
- setParent AELSMPointConstraintLayout;
- for ($i = $newNumPointConstraints; $i < $oldNumPointConstraints; $i++) {
- deleteUI -layout $oldPointConstraintLayouts[$i];
- }
- }
- columnLayout -e -vis true AELSMPointConstraintLayout;
- }
-
-
- global proc AELSMInputNurbsObjectNew ( string $plug )
- {
- setUITemplate -pst attributeEditorTemplate;
- columnLayout -adj true;
- textFieldGrp -l "Input Nurbs Object" -ed false LSMInputNurbsObject;
- setParent ..;
- AELSMInputNurbsObjectReplace( $plug );
- setUITemplate -ppt;
- }
-
-
- global proc AELSMInputNurbsObjectReplace ( string $plug )
- {
- // get the input nurbs object
- //
- string $inputAttr = ($plug+".inputNurbsObject");
- string $inputNode[] = `listConnections -d false -sh true $inputAttr`;
-
- textFieldGrp -e -tx $inputNode[0] LSMInputNurbsObject;
- }
-